﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes.actions {
    import Engine.Classes.*;
    import Classes.*;
    import Classes.effects.*;

    public class ActionAddEffect extends BaseAction {

        protected var m_actionStarted:Boolean = false;
        protected var m_effectType:EffectType;
        protected var m_mapResourceEffect:MapResourceEffect;

        public function ActionAddEffect(_arg1:MapResource=null, _arg2:EffectType=null){
            super(_arg1);
            this.m_effectType = _arg2;
        }
        override public function enter():void{
            super.enter();
            this.m_actionStarted = true;
            this.m_mapResourceEffect = MapResourceEffectFactory.createEffect(m_mapResource, this.m_effectType);
        }
        override public function reenter():void{
            super.reenter();
            this.m_actionStarted = true;
            this.m_mapResourceEffect = MapResourceEffectFactory.createEffect(m_mapResource, this.m_effectType);
        }
        override public function removed():void{
            this.m_actionStarted = false;
            this.m_mapResourceEffect.cleanUp();
            super.removed();
        }
        override public function getInterrupt():int{
            return ((this.m_actionStarted) ? State.NO_INTERRUPT : State.NORMAL_INTERRUPT);
        }
        override public function update(_arg1:Number):void{
            var _local2:AnimationEffect;
            if (this.m_actionStarted){
                if (!this.m_mapResourceEffect.isCompleted){
                    if ((this.m_mapResourceEffect is AnimationEffect)){
                        _local2 = (this.m_mapResourceEffect as AnimationEffect);
                        if (!_local2.isAutoUpdating){
                            _local2.updateAnimatedBitmap(_arg1);
                        };
                    };
                } else {
                    m_mapResource.actionQueue.removeState(this);
                };
            };
        }

    }
}//package Classes.actions 
